﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _28_Visitor
{
    /*对象结构*/
    class ObjectStructure
    {
        private IList<Persion> elements = new List<Persion>();

        public void Attach(Persion elenment)
        {
            elements.Add(elenment);
        }
        public void Detach(Persion element)
        {
            elements.Remove(element);
        }
        public void Display(Action visitor)
        {
            foreach (Persion e in elements)
            {
                e.Accept(visitor);
            }
        }
    }
}
